<%@ page import="org.internna.iwebjtracker.spring.mvc.ChangelogController" %>
<%@ taglib prefix="iwebmvc" uri="http://tags.iwebmvc.com" %>
<%@ taglib prefix="iwebjtracker" tagdir="/WEB-INF/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c-rt:set var="version" value="<%= ChangelogController.VERSION %>" />
<c-rt:set var="sessionUser" value="<%= org.internna.iwebmvc.security.UserManager.SESSION_USER %>" />
<c-rt:set var="subsession_id" value="<%= org.internna.iwebmvc.spring.jee.IWebMvcCombinedFilter.SUB_SESSION_COOKIE %>" />
<c-rt:set var="subsession_path" value="<%= org.internna.iwebmvc.spring.jee.IWebMvcCombinedFilter.SUB_SESSION_COOKIE_PATH %>" />
<div style="font-weight:bold;font-size:16px;color:#006699;margin-bottom:8px"><iwebmvc:message argMessage="ui.project.changelog" /></div>
<div style="width:800px;" class="border_${sessionScope[sessionUser].theme}">
    <div>
        <img src="<c:url value="/resource.iwebmvc?file=/images/common/closearrow_${sessionScope[sessionUser].theme}.jpg" />&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right:5px;vertical-align:bottom" />
        <img src="<c:url value="/resource.iwebmvc?file=/images/" /><c:choose><c:when test="${requestScope[version].parentVersion == null}">version</c:when><c:otherwise>milestone</c:otherwise></c:choose>.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right: 5px;vertical-align:bottom" />
        <span class="">${requestScope[version]}</span>
    </div>
    <div style="margin-top:5px;" class="overclear">
        <span class="float_left" style="margin-left:25px"><iwebmvc:message argMessage="ui.project.changelog.release" />&nbsp;</span>
        <span class="float_left"><fmt:formatDate value="${requestScope[version].dueDate}" /></span>
        <span class="float_right" style="margin-right:5px"><c:choose><c:when test="${requestScope[requestScope[version]] != null}">${fn:length(requestScope[requestScope[version]])} <iwebmvc:message argMessage="ui.project.changelog.issues" /></c:when><c:otherwise><iwebmvc:message argMessage="ui.project.changelog.noissues" /></c:otherwise></c:choose></span>
    </div>
    <c:if test="${not empty requestScope[version].milestones}">
        ${requestScope[milestone]}
        <c:forEach items="${requestScope[version].milestones}" var="milestone" varStatus="loop">
            <div style="margin-left:20px;margin-top:5px">
                <img id="img${loop}" src="<c:url value="/resource.iwebmvc?file=/images/common/closearrow_${sessionScope[sessionUser].theme}.jpg" />&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="display:none;margin-right:5px;vertical-align:bottom" onclick="dojo.style(byId('img${loop}'), 'display', 'none');dojo.style(byId('img${loop}_'), 'display', 'inline');var container = byId('container${loop}'); if(container) dojo.style(container, 'display', 'none');" />
                <img id="img${loop}_" src="<c:url value="/resource.iwebmvc?file=/images/common/openarrow_${sessionScope[sessionUser].theme}.gif" />&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="<c:if test="${requestScope[milestone] == null}">visibility:hidden;</c:if>margin-right: 5px;vertical-align:bottom" onclick="dojo.style(byId('img${loop}_'), 'display', 'none');dojo.style(byId('img${loop}'), 'display', 'inline');var container = byId('container${loop}'); if(container) dojo.style(container, 'display', 'block');" />
                <img src="<c:url value="/resource.iwebmvc?file=/images/" />milestone.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right: 5px;vertical-align:bottom" />
                <span class="">${milestone}</span>
            </div>
            <div style="margin-top:5px;" class="overclear">
                <span class="float_left" style="margin-left:45px"><iwebmvc:message argMessage="ui.project.changelog.release" />&nbsp;</span>
                <span class="float_left"><fmt:formatDate value="${milestone.dueDate}" /></span>
                <span class="float_right" style="margin-right:5px"><c:choose><c:when test="${requestScope[milestone] != null}">${fn:length(requestScope[milestone])} <iwebmvc:message argMessage="ui.project.changelog.issues" /></c:when><c:otherwise><iwebmvc:message argMessage="ui.project.changelog.noissues" /></c:otherwise></c:choose></span>
            </div>
            <c:if test="${requestScope[milestone] != null}">
                <div id="container${loop}" style="margin-left:40px;margin-top:5px;display:none">
                    <c:forEach items="${requestScope[milestone]}" var="innerissue">
                        <div style="margin-bottom:5px">
                            <img src="<c:url value="/resource.iwebmvc?file=/images/common/" />${fn:toLowerCase(innerissue.status)}_${sessionScope[sessionUser].theme}.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right:8px;vertical-align:bottom" />
                            <span style="margin-right:10px"><a href="javascript:openOrSelectTab('<iwebmvc:value encrypt="true" entity="${innerissue}" path="id" />', '${innerissue.alias}', 'issue')">${innerissue.alias}</a></span>
                            <span>${innerissue.summary}</span>
                        </div>
                    </c:forEach>
                </div>
            </c:if>
        </c:forEach>
    </c:if>
    <c:if test="${requestScope[requestScope[version]] != null}">
        <div style="margin-left:20px;margin-top:5px">
            <c:forEach items="${requestScope[requestScope[version]]}" var="issue">
                <div style="margin-bottom:5px" class="overclear">
                    <div class="float_left">
                        <img src="<c:url value="/resource.iwebmvc?file=/images/common/" />${fn:toLowerCase(issue.type)}_${sessionScope[sessionUser].theme}.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right:8px;vertical-align:bottom" alt="<iwebmvc:message argMessage="Type.${issue.type}" />" />
                        <img src="<c:url value="/resource.iwebmvc?file=/images/common/" />${fn:toLowerCase(issue.severity)}_${sessionScope[sessionUser].theme}.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right:8px;vertical-align:bottom" alt="<iwebmvc:message argMessage="Severity.${issue.severity}" />" />
                        <span style="margin-right:10px"><a href="javascript:openOrSelectTab('<iwebmvc:value encrypt="true" entity="${issue}" path="id" />', '${issue.alias}', 'issue')">${issue.alias}</a></span>
                        <span>${issue.summary}</span>
                    </div>
                    <img class="float_right" src="<c:url value="/resource.iwebmvc?file=/images/common/" />${fn:toLowerCase(issue.resolutionStatus)}_${sessionScope[sessionUser].theme}.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right:8px;vertical-align:bottom" alt="<iwebmvc:message argMessage="ResolutionStatus.${issue.resolutionStatus}" />" />
                    <img class="float_right" src="<c:url value="/resource.iwebmvc?file=/images/common/" />${fn:toLowerCase(issue.status)}_${sessionScope[sessionUser].theme}.gif&${requestScope[subsession_path]}=${requestScope[subsession_id]}" style="margin-right:8px;vertical-align:bottom" alt="<iwebmvc:message argMessage="Status.${issue.status}" />" />
                </div>
            </c:forEach>
        </div>
    </c:if>
</div>